package com.yonyougov.devops.cruxcisupport.subscribe;

import com.yonyougov.devops.fwc.core.dao.impl.BaseDaoImpl;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.*;

/**
 * t_subscribe数据层实现
 */
@Repository
public class SubscribeDaoImpl extends BaseDaoImpl<SubscribeEntity, BigInteger> implements SubscribeDao {
    private final SqlSessionTemplate sqlSessionTemplate;

    public SubscribeDaoImpl(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    //<!--用户自定义代码开始-->
    @Override
    public void batchDelete(List<SubscribeEntity> subscribeEntity) {
        String statement = SubscribeEntity.class.getName() + "Mapper.batchDelete";
        sqlSessionTemplate.delete(statement, subscribeEntity);
    }

    @Override
    public List<SubscribeEntity> findByAppIds(Set<BigInteger> appIds) {
        if (null == appIds || appIds.size() == 0) return new ArrayList<>();
        String statement = SubscribeEntity.class.getName() + "Mapper.findByAppIds";
        Map<String, Set<BigInteger>> map = new HashMap<>();
        map.put("list", appIds);
        return sqlSessionTemplate.selectList(statement, map);
    }
    //<!--用户自定义代码结束-->
}
